<template>
  <div class="dashboard-container">
    <component :is="currentRole" />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import adminDashboard from './admin'
import supplierDashboard from './supplier'
import storeDashboard from './store'

export default {
  name: 'Dashboard',
  components: { adminDashboard, supplierDashboard, storeDashboard },
  data() {
    return {
      currentRole: 'adminDashboard'
    }
  },
  computed: {
    ...mapGetters(['roles'])
  },
  created() {
    if (this.roles.includes('supplier')) {
      this.currentRole = 'supplierDashboard'
    } else if (this.roles.includes('store')) {
      this.currentRole = 'storeDashboard'
    }else{

       this.currentRole="adminDashboard"
    }
  }
}
</script>
